import request from "@/utils/request";

export default {
  /**
   * 获取新闻分类
   */
  categorys() {
    return request.get("category/lists");
  },
  /**
   * 获取新闻列表
   * @param cid int 新闻分类id  0或不传则获取全部
   * @param page int
   * @param size int  
   */
  lists(cid, page = 1, size = 10) {
    return request.get("news/lists", {
      catId: cid,
      page,
      size
    });
  },
  /**
   * 获取新闻详情
   * @param id int 新闻id
   */
  detail(id) {
    return request.get("news/detail", {
      newId: id
    });
  },
  // 评论
  postComment(id, content) {
    return request.post("news/comment", {
      newId: id,
      content
    })
  },
  /**
   * 获取新闻评论列表
   * @params id int 新闻ID
   * @param page int
   * @param size int  
   */
  getComments(id, page = 1, size = 10) {
    return request.get("news/commentList", {
      newId: id,
      page,
      size
    });
  },
  // 获取单文字 1隐私政策2用户协议
  getSingleArticle(type) {
    if (type === 1) {
      return request.get("public/privacy");
    } else {
      return request.get("public/aggrement");
    }

  },

};
